import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)
var arr = [
  {
    // id:1,
    title: "耀莱成龙影城（建业店)",
    address: "金水区普惠路77号绿地之窗尚峰座正大乐成",
    price: "19.9元",
    distance: "1.2Km",
    activity1: "我是药神等4部影片特惠",
    activity2: "观影套餐限量特惠",
    activity3: "开卡特惠，每单2张立减2元"
  },
  {
    // id:2,
    title: "五一影城",
    address: "管城回族区东风南路尚鼎路",
    price: "19.9元",
    distance: "1.7km",
    activity1: "我是药神等4部影片特惠",
    activity2: "观影套餐限量特惠",
    activity3: "限时¥24促销开卡，首单更优惠，开卡即…"
  },
  {
    // id:3,
    title: "五一影城",
    address: "管城回族区东风南路尚鼎路",
    price: "19.9元",
    distance: "1.7Km",
    activity1: "我是药神等4部影片特惠",
    activity2: "观影套餐限量特惠",
    activity3: "开卡特惠，每单2张立减2元"
  },
  {
    // id:4,
    title: "耀莱成龙影城（建业店)",
    address: "金水区普惠路77号绿地之窗尚峰座正大乐成",
    price: "19.9元",
    distance: "1.2Km",
    activity1: "我是药神等4部影片特惠",
    activity2: "观影套餐限量特惠",
    activity3: "开卡特惠，每单2张立减2元"
  }
];


var list = []; //   1
for (var i = 0; i < 4; i++) {
  var obj = {
    time: "15:30",
    leave: "17:14散场",
    type: "原版3D",
    room: "2号厅（冠名 招商中）",
    price: "30.9元",
    buy: "购票",
  };
  list.push(obj); //  2
}


import citylist from '@/assets/js/data.json'
import hotlists from '@/assets/js/hotcry.json'


export default new Vuex.Store({
  state: {
    arr,
    list,
    bill:0,
    obj:{},
    lists: citylist,

    userList:[
      {
        img:require("@/assets/images/user/user-us.png"),
        title:"后来的我们",
        detail:"剧情",
        contry:"中国/105分钟",
        time:"2017-8-4",
        code: 9/2,
        eval:"很好",
        ids:Math.random(),
        starImg:require("@/assets/images/user/user-one.png")
      },
      {
        img:require("@/assets/images/user/user-beer.png"),
        title:"帕丁顿熊",
        detail:"动画/奇幻",
        contry:"美国/105分钟",
        time:"2019-8-4",
        code: 8/2,
        eval:"一般",
        ids:Math.random(),
        starImg:require("@/assets/images/user/user-one.png")
      },
      {
        img:require("@/assets/images/user/user-fish.png"),
        title:"大鱼海棠",
        detail:"动画/奇幻",
        contry:"中国/120分钟",
        time:"2010-8-4",
        code: 8/2,
        eval:"一般",
        ids:Math.random(),
        starImg:require("@/assets/images/user/user-one.png")
      },
    ],
    orderList:[
      {
        cinema:"万达国际影城",
        num:2,
        price:35,
        imgs:require("@/assets/images/user/user-us.png"),
        title:"后来的我们",
        time:"05月16日 17:00",
        address:"五号厅 5排14座 5排15座",
        tips:"已完成",
        state:0,
        ids:Math.random()
      },
      {
        cinema:"万达国际影城",
        num:1,
        price:35,
        imgs:require("@/assets/images/user/user-beer.png"),
        title:"帕丁顿熊",
        time:"05月16日 17:00",
        address:"五号厅 5排14座",
        tips:"待付款",
        state:1,
        ids:Math.random()
      },
      {
        cinema:"万达国际影城",
        num:1,
        price:35,
        imgs:require("@/assets/images/user/user-fish.png"),
        title:"大鱼海棠",
        time:"05月16日 17:00",
        address:"五号厅 5排14座 5排15座",
        tips:"待评价",
        state:2,
        ids:Math.random()
      },
      {
        cinema:"万达国际影城",
        num:1,
        price:35,
        imgs:require("@/assets/images/user/user-star.png"),
        title:"星空",
        time:"05月16日 17:00",
        address:"五号厅 5排14座 ",
        tips:"待退款",
        state:3,
        ids:Math.random()
      },
    ],
    messageList:[
          {
            imgs:require("@/assets/images/user/user-fir.png"),
            names:"Zeng Wen",
            tips:"暂时还没有收到评论",
            times:"一个月前",
            num:1,
            id:Math.random()
        },
        {
            imgs:require("@/assets/images/user/user-sec.png"),
            names:"Chikelu Obasea",
            tips:"暂时还没有收到评论",
            times:"一个月前",
            num:2,
            id:Math.random()
        },{
            imgs:require("@/assets/images/user/user-thir.png"),
            names:"Kimmy McIlmorie",
            tips:"暂时还没有收到评论",
            times:"一个月前",
            num:1,
            id:Math.random()
        },
        {
            imgs:require("@/assets/images/user/user-thr.png"),
            names:"Xu Jianhong",
            tips:"暂时还没有收到评论",
            times:"一个月前",
            num:3,
            id:Math.random()
        },
        {
            imgs:require("@/assets/images/user/user-for.png"),
            names:"Kung Jiyeon",
            tips:"暂时还没有收到评论",
            times:"一个月前",
            num:2,
            id:Math.random()
        }
    ],
    hotlists: hotlists,
    cityHistory: [{
      name: '郑州',
      id: Math.random()
    }],
    cityPosition: '郑州',

    //movie

    paths: '',
  },
  mutations: {
    choiceCity(state, v) {
      if (state.cityHistory.some(ele => ele.name == v.name)) {
        state.cityPosition = v.name
      } else {
        state.cityHistory.push(v)
        state.cityPosition = v.name
      }

    },

    positionCity(state, v) {
      let arr = v.split('')
      for (let i = 0; i < arr.length; i++) {
        if (arr[i] == '市') {
          arr.splice(i, 1)
        }
      }
      state.cityPosition = arr.join('')
    },
    //movie
    coming(state, val) {
      state.paths = val
    }     
  },
  mutations: {
    paths: '',
  },
  mutations: {
    //编辑删除
    del(state,val){
      state.orderList.splice(val,1)
    },
    choiceCity(state, v) {
      if (state.cityHistory.some(ele => ele.name == v.name)) {
        state.cityPosition = v.name
      } else {
        state.cityHistory.push(v)
        state.cityPosition = v.name
      }

    },

    positionCity(state, v) {
      let arr = v.split('')
      for (let i = 0; i < arr.length; i++) {
        if (arr[i] == '市') {
          arr.splice(i, 1)
        }
      }
      state.cityPosition = arr.join('')
    },
    //movie
    coming(state, val) {
      state.paths = val
    }
  },
  actions: {},
  modules: {}
})


